//
//  ProfileManager.m
//  Auction
//
//  Created by Gary on 15/9/17.
//  Copyright (c) 2015年 Lebo. All rights reserved.
//

#import "ProfileManager.h"
#import "Common.h"

@implementation ProfileManager

- (instancetype)init {
    self = [super init];
    if (self) {
        self.moduleID = EProfileManager;
    }
    return self;
}

#pragma mark - 业务请求处理

#pragma mark - 获取个人资料

- (void)getProfileWithData:(id)data {
    LogFunc;
    NSMutableDictionary *dic = [(NSDictionary*)data objectForKey:kNetworkRequestData];
    dic[kNetReqParamTokenKey] = [Common currentDeivceToken];
    [BF callBusinessFunc:BusinesID(ENetworkManager, ENetReqPostGetProfile) inParam:data];
}

- (void)getProfileResponse:(id)data {
    [Common analyseNetworkResponseAndNotify:data
                                   moduleID:EProfileManager
                                  funIDSucc:EProfileGetProfileSucc
                                  funIDFail:EProfileGetProfileFail];
}

#pragma mark - 框架函数

//调用业务模块功能处理
/**
 * @brief
 *
 * Detailed comments of this function
 * @param[in]
 * @param[out]
 * @return
 * @note
 */
- (int)callBusinessFunc:(NSUInteger)funcID inParam:(id)inParam outParam:(id *)outParam {
    switch (funcID) {
        case EProfileGetProfile: {
            [self getProfileWithData:inParam];
            break;
        }
            
        default:
            break;
    }
    
    return 0;
}

/**
 * @brief
 *
 * Detailed comments of this function
 * @param[in]
 * @param[out]
 * @return
 * @note
 */
- (void)onBusinessNotify:(NSUInteger)notifyID inParam:(id)inParam {
    switch (notifyID) {
        case BusinesID(ENetworkManager, ENetReqPostGetProfile): {
            if (inParam) {
                [self getProfileResponse:inParam];
            }
            break;
        }
            
        default:
            break;
    }
}

@end
